import * as qs from "qs";
import { AdvanceRecord } from "../type/HospitalData";
import { HealthCard } from "../type/UserInfoData";
import service from "./Service";

/**
 * 获取就诊卡
 */
export function getHealthCardList() {
  return service.get<HealthCard[]>("/user/getHealthCardList");
}
/**
 * 添加就诊卡
 */
export function addHealthCard(data: HealthCard) {
  return service.post("/healthCards", data);
}
/**
 * 删除就诊人
 */
export function deleteHealthCard(id: number) {
  return service.delete(`/healthCards/${id}`);
}
/**
 * 修改就诊人
 */
export function modifyHelthCard(id: number, data: HealthCard) {
  return service.put(`/healthCards/${id}`, data);
}
/**
 * 设置默认就诊人
 */
export function setDefaultHealthCard(id: number) {
  return service.post("/user/defaultHealthCard", null, { params: { id } });
}
/**
 * 登录接口
 */
export function loginIn(param: any) {
  return service.post("/login/loginByPhonePwd", qs.stringify(param));
}
/**
 * 登出
 */
export function logOutDo() {
  return service.get("/login/loginOut");
}
/**
 * 添加预约
 */
export function addAdvanceRecord(param: AdvanceRecord) {
  return service.post("/confirm", qs.stringify(param));
}

/**
 * 获取用户信息
 */
export function getUserInfo() {
    return service.get("/user/getAccountById");
}

/**
 * 获取本地址文件
 */
export function getAddressData() {
  return service.get("/province.json",{baseURL: "" });
}

export function getUserInfoMessage() {
    return service.get("/user/getMessageLog");
}